#pragma once
#include "nodes\SpriteNode.h"
#include "addons\SpriteCounter.h"
#include <nodes\TextNode.h>

class NewHUD : public ds::Node {

struct PowerupIndicator {
	ds::SHandle spriteHandle;
	bool state;
};

public:
	NewHUD() : ds::Node("NewHUD","TexturesMaterial") {
		m_TextNode = new ds::TextNode("NewHud","TexturesMaterial","xscale");
		gEngine->getWorld().attachNode(m_TextNode,"HUD");
	}
	~NewHUD() {}
	void init();
	void update(float elapsed);
	void reset() {
		m_Points = 0;
		//m_Score->setCounter(0);
		m_Health = 10;
		//m_HealthBar->setCounter(m_Health);
		m_Credits = 0;
		//m_CreditsCounter->setCounter(m_Credits);
	}
	void addScore(int value) {
		m_Points += value;
		//m_Score->setCounter(m_Points);
		m_Scaled = true;
		m_Scaling = 2.0f;
		m_ScaleTimer = 0.0f;
	}
	int decHealth(int health) {
		m_Health -= health;
		if ( m_Health < 0 ) {
			m_Health = 0;
		}
		//m_HealthBar->setCounter(m_Health);
		return m_Health;
	}
	int incHealth(int health) {
		if ( m_Health < 100 ) {
			m_Health += health;
			//m_HealthBar->setCounter(m_Health);
		}
		return m_Health;
	}
	void incCredits(int credits);
	int getCredits() {
		return m_Credits;
	}
	void setLevel(int lvl) {
		//m_LevelCounter->setCounter(lvl+1);
	}
	int getPoints() const {
		return m_Points;
	}
	bool isPowerupAvailable(const char* name);
	void usePowerup(const char* name);

	void loadContent( ds::ResManager& resourceManager );

private:
	//ds::SpriteNode* m_Sprites;
	ds::TextNode* m_TextNode;
	int m_Points;
	int m_Health;
	int m_Credits;
	bool m_Scaled;
	float m_Scaling;
	float m_ScaleTimer;
	// powerups
	PowerupIndicator* m_HealtIndicator;
	PowerupIndicator* m_DSIndicator;
	PowerupIndicator* m_TSIndicator;
};

